﻿using System;
using Sharp.Portal;
using Sharp.Portal.AdminLTE;
using Sharp.Portal.Other;

namespace Sharp.WebBooter.Areas.Demo.Models
{
    [Title("排查管理")]
    [DataHandler(ModuleOP.Details, "浏览", 0)]
    [DataHandler(ModuleOP.Create, "发现", 1)]
    [DataHandler(ModuleOP.Edit, "修改", 2)]
    [DataHandler(ModuleOP.Delete, "删除", 3)]
    [DataHandler(ModuleOP.Refresh, "刷新", 4)]
    public class TroubleshootingIndexModel : BSSharpList
    {
        public TroubleshootingIndexModel()
        {
            this.Feature = ListFeature.MultiSelect | ListFeature.Paging | ListFeature.RowNumber;
            this.Breadcrumb = "<ol class=\"breadcrumb\"> <li><a href =\"@Url.Action(\"Index\", \"Home\")\"><i class=\"fa fa-home\"></i> 首页</a></li> <li class=\"active\">隐患排查</li></ol>";
            this.ListControlId = "troubleshootingDataList";
            this.ImportJavascript = "~/Areas/Demo/Scripts/TroubleshootingViewModel.js";
        }
        [Column(Hidden = true)]
        public int Id { get; set; }

        /// <summary>
        /// 流水号
        /// </summary>
        [Column(Width = 126, Text = "流水号")]
        public string Flownumber { get; set; }
        /// <summary>
        /// 排查人
        /// </summary>
        [Column(Width = 100, Text = "排查人")]
        public string Investigators { get; set; }
        /// <summary>
        /// 排查时间
        /// </summary>
        [DateColumn(Width = 100, Text = "排查时间", Format = "YYYY-MM-DD")]
        public DateTime InvestigationTime { get; set; }
        /// <summary>
        /// 隐患确认
        /// </summary>
        [BooleanColumn(Width = 70, Text = "隐患确认", TrueText = "存在隐患", FalseText = "", Align = Alignment.Center, DataIndex = "confirmation.dangerConfirmation"), QueryOption(Option = QueryFeature.NoneQuery)]
        [ClientDrawRow(Color = RowFontColor.LightRed, Condition = "{text}==''")]
        public bool HasDanger { get; set; }
      
        /// <summary>
        /// 隐患描述
        /// </summary>
        [Column(Width = 250, Text = "隐患描述"), QueryOption(Option = QueryFeature.DefualtQuery)]
        public string DangerDescribe { get; set; }
        ///// <summary>
        ///// 现场图片
        ///// </summary>
        //[TemplateColumn(Width = 100, Text = "现场图片", TemplateString = "function (data, type, row, meta) { return '<img src=\"' + row.scenePicture + '\" />'; }", Align = Alignment.Center)]
        //public string ScenePicture { get; set; }



        [TemplateColumn(Width = 100, Text = "操作", TemplateString = "function(data, type, row, meta) { return new TroubleshootingViewModel().showButton(data, type, row, meta); }", Align = Alignment.Center), QueryOption(Option = QueryFeature.NoneQuery)]
        public string OP { get; set; }

    }
}
